export default {
	state: {
		treeList: [],
		// 用于存放具有 objType 属性的列表
		objTypeTreeList: [],
		version: {},
		versionList: [],
		versionConversion: false,

		userInfo: {},
		versionStateFlag: false,
	},
	getters: {
		getterTreeList: (state) => state.treeList,
		getterObjTypeTreeList: (state) => state.objTypeTreeList,
		getterVersion: (state) => state.version,
		getterVersionList: (state) => state.versionList,
		getterVersionConversion: (state) => state.versionConversion,

		getterUserInfo: (state) => state.userInfo,
		getterVersionStateFlag: (state) => state.versionStateFlag,
	},
	actions: {
		actionTreeList({ commit }, data) {
			commit("setTreeList", data);
		},
		actionObjTypeTreeList({ commit }, data) {
			commit("setObjTypeTreeList", data);
		},
		actionVersion({ commit }, data) {
			// console.error("data", data);
			if (typeof data !== "object") return;
			commit("setVersion", data);
		},
		actionVersionList({ commit }, data) {
			commit("setVersionList", data);
		},
		actionVersionConversion({ commit }, data) {
			commit("setVersionConversion", data);
		},
		actionUserInfo({ commit }, data) {
			commit("setUserInfo", data);
		},
		actionVersionStateFlag({ commit }, data) {
			commit("setVersionStateFlag", data);
		},
	},
	mutations: {
		setTreeList: (state, data) => (state.treeList = data),
		setObjTypeTreeList: (state, data) => (state.objTypeTreeList = data),
		setVersion: (state, data) => (state.version = data),
		setVersionList: (state, data) => (state.versionList = data),
		setVersionConversion: (state, data) => (state.versionConversion = data),
		setUserInfo: (state, data) => (state.userInfo = data),
		setVersionStateFlag: (state, data) => {
			state.versionStateFlag = data;
		},
	},
};
